// pages/student/practice-record/practice-record.js
Page({
  data: {
    records: [],
    loading: true
  },
  onLoad() {
    this.loadRecords()
  },
  loadRecords() {
    wx.showLoading({ title: '加载中...' })
    setTimeout(() => {
      const records = [
        {
          id: 1,
          courseName: '微信小程序开发实战',
          practiceName: '第一章练习',
          score: 85,
          totalScore: 100,
          correctRate: 85,
          completedTime: '2024-01-15 14:30',
          questionCount: 20,
          correctCount: 17
        },
        {
          id: 2,
          courseName: 'UI/UX设计精品课',
          practiceName: '设计原理测试',
          score: 92,
          totalScore: 100,
          correctRate: 92,
          completedTime: '2024-01-14 10:20',
          questionCount: 25,
          correctCount: 23
        }
      ]
      
      this.setData({
        records: records,
        loading: false
      })
      wx.hideLoading()
    }, 500)
  },
  viewDetail(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/student/practice-result/practice-result?id=${id}`
    })
  }
})
